//
//  AnalysisViewController.m
//  PureProject
//
//  Created by Tung Tran on 4/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "AnalysisViewController.h"
#import "MasterAnalysisViewController.h"
#import "DetailAnalysisViewController.h"

@interface AnalysisViewController ()

@end

@implementation AnalysisViewController

@synthesize splitViewController = _splitViewController;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        MasterAnalysisViewController *masterAnalysisView = [[MasterAnalysisViewController alloc] initWithNibName:@"MasterAnalysisViewController" bundle:nil];
        
        UINavigationController *masterAnalysisNV = [[UINavigationController alloc] initWithRootViewController:masterAnalysisView];
        [masterAnalysisView release];
        
        DetailAnalysisViewController *detailAnalysisView = [[DetailAnalysisViewController alloc] initWithNibName:@"DetailAnalysisViewController" bundle:nil];
        [masterAnalysisView setDetailAnalysisView:detailAnalysisView];
        UINavigationController *detailAnalysisNV = [[UINavigationController alloc] initWithRootViewController:detailAnalysisView];
        [detailAnalysisView release];
        
        self.splitViewController = [[UISplitViewController alloc] init];
        self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterAnalysisNV, detailAnalysisNV, nil];
        [masterAnalysisNV release];
        [detailAnalysisNV release];
        
        [masterAnalysisView setAnalysisView:self];
        [detailAnalysisView setAnalysisViewDT:self];
        
        [self.splitViewController.view setFrame:CGRectMake(0, 0, 1024, 639)];
        
        //self.view = self.splitViewController.view;
        [self.view addSubview:self.splitViewController.view];
        [_splitViewController release];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

@end
